home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 23 / Amiga Format AFCD23 (Feb 1998, Issue 107).iso / -seriously_amiga- / shareware / programming / other / iff-rgfx / rgfx.h < prev   
C/C++ Source or Header  |  1997-12-12  |  7KB  |  217 lines

  1. /*
  2. **      $VER: rgfx 1.2 (7.12.97)
  3. **
  4. **      Specs and structure definitions for the IFF-RGFX file format -
  5. **
  6. **      (C) Copyright 1997 Andreas R. Kleinert
  7. **      Freeware. All Rights Reserved.
  8. */
  9.  
  10. #ifndef RGFX_H
  11. #define RGFX_H
  12.  
  13. #ifndef EXEC_TYPES_H
  14. #include <exec/types.h>
  15. #endif /* EXEC_TYPES_H */
  16.  
  17. #ifndef LIBARIES_IFFPARSE_H
  18. #include <libraries/iffparse.h>
  19. #endif /* LIBARIES_IFFPARSE_H */
  20.  
  21.  
  22. /* *************************************************** */
  23. /* *                                                 * */
  24. /* * IFF/RGFX specific definitions and declarations  * */
  25. /* *                                                 * */
  26. /* *************************************************** */
  27.  
  28. #define ID_FORM  MAKE_ID('F','O','R','M')  /* if not already defined */
  29. #define ID_RGFX  MAKE_ID('R','G','F','X')  /* IFF-RGFX               */
  30.  
  31. /* A typical structure of a RGFX file (recommended) :
  32.  
  33.      FORM-RGFX
  34.  
  35.        RGHD
  36.        RSCM
  37.        RCOL
  38.        RBOD
  39. */
  40.  
  41.  
  42. /*******************************************************
  43.    RGHD - RawGfx Bitmap Header
  44.  
  45.    ** This one replaces BMHD
  46.  
  47. */
  48.  
  49. #define ID_RGHD  MAKE_ID('R','G','H','D')
  50.  
  51. struct RGHD
  52. {
  53.  ULONG rgfx_LeftEdge;     /* (see BMHD)                               */
  54.  ULONG rgfx_TopEdge;      /* (see BMHD)                               */
  55.  ULONG rgfx_Width;        /* (see BMHD)                               */
  56.  ULONG rgfx_Height;       /* (see BMHD)                               */
  57.  ULONG rgfx_PageWidth;    /* (see BMHD)                               */
  58.  ULONG rgfx_PageHeight;   /* (see BMHD)                               */
  59.  
  60.  ULONG rgfx_Depth;        /* 1-8         for RMBT_BYTEPLANAR8,
  61.                              1-8         for RMBT_BYTECHUNKY8,
  62.                               24         for RMBT_3BYTERGB24          */
  63.  ULONG rgfx_PixelBits;    /* 1-8         for RMBT_BYTEPLANAR8,
  64.                                8         for RMBT_BYTECHUNKY8,
  65.                               24         for RMBT_3BYTERGB24          */
  66.  ULONG rgfx_BytesPerLine; /* (width+7)/8 for RMBT_BYTEPLANAR8,
  67.                               width      for RMBT_BYTECHUNKY8,
  68.                               width*3    for RMBT_3BYTERGB24          */
  69.  
  70.  ULONG rgfx_Compression;  /* RCMP_ type flag                          */
  71.  ULONG rgfx_XAspect;      /* (see BMHD)                               */
  72.  ULONG rgfx_YAspect;      /* (see BMHD)                               */
  73.  ULONG rgfx_BitMapType;   /* RBMT_ type flag                          */
  74. };
  75.  
  76.  /* if you encounter unknown depth/pixelbits/bytesperline combinations,
  77.     then do reject these (future expansions). But so far, only use
  78.     the legally defined ones yourself ! Don't define own formats,
  79.     e.g. for 16 Bit or for BGR !
  80.   */
  81.  
  82. #define RCMT_NOCOMPRESSION  (0L)
  83. #define RCMT_XPK            (1L)
  84.  
  85. #define RMBT_BYTEPLANAR8    (0L)   /* unaligned planar 8 bit bitmap */
  86. #define RMBT_BYTECHUNKY8    (1L)   /* unaligned chunky 8 bit bitmap */
  87. #define RMBT_3BYTERGB24     (2L)   /* 3-byte 24 bit RGB triples     */
  88. /* ***************************************************** */
  89.  
  90.  
  91. /*******************************************************
  92.    RSCM - RawGfx ScreenMode
  93.  
  94.    ** This one replaces CAMG.
  95.  
  96.    The default setting is:
  97.  
  98.    rscm_AGA:  default screenmode
  99.    rscm_CGfx: INVALID_ID
  100.    rscm_P96:  INVALID_ID
  101.  
  102.    if ModeNotAvailable( rscm_P96 ) does return an error,
  103.    then try ModeNotAvailable( rscm_CGfx ) - on error,
  104.    then try ModeNotAvailable( rscm_AGA ).
  105.  
  106.    Use the first ID, which is available, otherwise compute
  107.    one yourself by using BestModeID()
  108.  
  109.  
  110.    Note: Since HAM modes only can be identified by their
  111.          ID, you should make sure, tht CGfx/P96 are set
  112.          to INVALID_ID and that AGA is OR'ed with HAM_KEY
  113.          for these modes.
  114.          For EHB, you should make sure, that the AGA viewmode
  115.          field is OR'ed with EXTRAHALFBRITE_KEY - if you want
  116.          to keep that feature with the graphics. Please also
  117.          see colormap notes for EHB.
  118.          (see <graphics/modeid.h>)
  119.  
  120. */
  121.  
  122. #define ID_RSCM  MAKE_ID('R','S','C','M')
  123.  
  124. struct RSCM
  125. {
  126.  ULONG rscm_AGA;  /* 32 Bit AGA  Viewmode ID */
  127.  ULONG rscm_CGfx; /* 32 Bit CGfx Viewmode ID */
  128.  ULONG rscm_P96;  /* 32 Bit P96  Viewmode ID */
  129. };
  130. /* ***************************************************** */
  131.  
  132.  
  133. /*******************************************************
  134.    RCOL - RawGfx Colormap
  135.  
  136.    ** This one replaces CMAP,
  137.  
  138.       Required with RMBT_BYTEPLANAR8 and RMBT_BYTECHUNKY8,
  139.       and optionally allowed with RMBT_3BYTERGB24 for use
  140.       as a dithering destination colormap.
  141.  
  142.       Stored are 256 byte triples in RGB format. Note, that
  143.       full-range values (0..255) have to be stored.
  144.  
  145.       Sample:   rcol_Colors[0][0]   = 0..255 red   value, color #0 (1st)
  146.                 rcol_Colors[0][1]   = 0..255 green value, color #0
  147.                 rcol_Colors[0][2]   = 0..255 blue  value, color #0
  148.                 ...
  149.                 rcol_Colors[255][0] = 0..255 red   value, color #255 (256th)
  150.                 rcol_Colors[255][1] = 0..255 green value, color #255
  151.                 rcol_Colors[255][2] = 0..255 blue  value, color #255
  152.  
  153.  
  154.       Unused entries should be filled with zeroes.
  155.  
  156.  
  157.    Allowed boolean values:  TRUE (1L) and FALSE (0L)
  158.  
  159.    Note: With EHB mode, which e.g. uses 64 colors with only a 32 color
  160.          palette, you always should store the full color range within
  161.          the RCOL structure: if someone is going to display EHB pictures
  162.          on an RTG screen, he won't have to calculate the 'missing'
  163.          colors by himself.
  164.  
  165. */
  166.  
  167. #define ID_RCOL  MAKE_ID('R','C','O','L')
  168.  
  169. struct RCOL
  170. {
  171.  ULONG rcol_TransColor;      /* boolean: is there a transparent color ?  */
  172.  ULONG rcol_TransColorNum;   /* yes, it's number ... from the ones below */
  173.  UBYTE rcol_Colors[256][3];
  174. };
  175. /* ***************************************************** */
  176.  
  177.  
  178. /*******************************************************
  179.    RBOD - RawGfx Bitmap Body
  180.  
  181.    ** This one replaces BODY
  182. */
  183.  
  184. #define ID_RBOD  MAKE_ID('R','B','O','D')
  185.  
  186. /* May look like:
  187.  
  188. struct RBOD
  189. {
  190.  UBYTE rbod_XPK[3];     ** containing 'XPK'
  191.  UBYTE rbod_BitMap[];
  192. };
  193.  
  194.    Or simply:
  195.  
  196. struct RBOD
  197. {
  198.  UBYTE rbod_BitMap[];
  199. };
  200.  
  201.  This has not been defined as a union structure here, since some
  202.  compilers might add unwished pad bytes to the structure.
  203.  
  204.  You should reference this chunk as an UBYTE array, only.
  205.  
  206.  ******************************************************* */
  207.  
  208.  
  209. /*******************************************************
  210.    RGFX - Other chunks
  211.  
  212.    - NAME, AUTH, ANNO and (C) chunks are allowed
  213.    -
  214. ******************************************************** */
  215.  
  216. #endif /* RGFX_H */
  217.